package com.woniuxy.finance.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.finance.model.entity.BusinessCompetitor;
import com.woniuxy.finance.model.vo.ClientVo;
import com.woniuxy.finance.model.vo.CountClientVo;
import com.woniuxy.finance.model.vo.FindClientNameAndBalanceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 友商信息表; Mapper 接口
 * </p>
 *
 * @author chenlin
 * @since 2023-09-06
 */
@Mapper
public interface BusinessCompetitorMapper extends BaseMapper<BusinessCompetitor> {
    /**
     * 充值
     * @return
     */
    boolean updateBalanceByName(BusinessCompetitor businessCompetitor);
    /**
     * 根据客户名称查询余额
     * @param businessCompetitor
     * @return
     */
    BigDecimal findBalanceByName(BusinessCompetitor businessCompetitor);
    /**
     * 根据客户名称扣除余额
     * @param businessCompetitor
     * @return
     */
    boolean deductBalanceByName(BusinessCompetitor businessCompetitor);

    List<ClientVo> getName(BusinessCompetitor businessCompetitor);

    /**
     * 统计客户信息和充值总额
     * @param voPage
     * @return
     */
    IPage<CountClientVo> countClientData(Page<CountClientVo> voPage);

    /**
     * 获取客户名和余额
     * @return
     */
    List<FindClientNameAndBalanceVo> findClientNameAndBalance();

    /**
     * 获取客户名和充值总额
     * @return
     */
    List<FindClientNameAndBalanceVo> findClientNameAndRechargeTotal();

    /**
     * 根据id获取邮箱
     * @param b
     * @return
     */
    String getEmailById(BusinessCompetitor b);
}
